package tomove;

import org.jbehave.core.annotations.AfterStory;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;

import com.aol.library.AolLibrary;

public class AddProductScenarioSteps {

	AolLibrary aol;
	public AddProductScenarioSteps() throws Exception{
	
		aol = new AolLibrary();
	}
	
	
	@Given("I am a shopper")
	public void ImShopper() {
		System.out.println("welcome");	
	}
	
	@When("I am viewing HomePage")
	public void viewHomePage() throws Exception{
		
		System.out.println("Viewing Homepage");
		aol.openURL("http://appliancesonline.com.au");
		aol.maximise();
		
	}
	
	@Then("I search for <product>")
	public void searchProduct(@Named("product") String product) {
		try{
			System.out.println("looking for product " + product);
			aol.searchItem("Home_search_textbox", product, "Home_search_button");
			} catch (Exception e) {
				e.printStackTrace();
			}	
		}	
	
	
	@Then("I browse through <product> pages")
	public void browseThroughProduct(@Named("product") String product) throws Exception{
		try {
			System.out.println("browsing through: " + product);
			aol.browseProduct();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
		

	@Then("I view <product> details")
	public void viewProduct(@Named("product") String product) throws Exception{
			
		}
		
	@Then("I add <product> to cart")
	public void addProduct(@Named("product") String product) throws Exception{
			
		}
		
		
	
	
	@AfterStory
	public void afterStory(){
		aol.closeDriver();
	}
	

}
